using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Data/State/Player/PlayerIdle", fileName = "PlayerIdle")]
public class PlayerState_Idle : PlayerState
{
    //
    public override void Enter()
    {
        base.Enter();
        playerControl.SetVelocity(Vector2.zero);
        
        // 变量设置
        playerDetection.IsCanAirJumo = true;
        // 玩家脚步激活
        playerFoot.SetActive(true);
    }
    
    //
    public override void Exit()
    {
        base.Exit();
    }
    
    //
    public override void LogicUpdate()
    {
        base.LogicUpdate();
        // 输入
        if(playerInput.isInputMove)
            stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_Run)]);
        if(playerInput.isInputJump)
            stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_Jump)]);
        if(playerInput.isInputRoll)
            stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_Roll)]);
        if(playerInput.isInputFall)
            stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_FallG)]);
        // 状态
        if(playerStatusInformation.IsFly)
            stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_Fly)]);
        if(playerStatusInformation.PlayerIsHit)
            stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_Hit)]);
        if(playerStatusInformation.GetPlayerIsDeath)
            stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_Death)]);
    }
    
    //
    public override void PhysicalUpdate()
    {
        base.PhysicalUpdate();
    }
}
